fix: stop -Werror from propagating to downstream consumer builds#2560
fix: stop -Werror from propagating to downstream consumer builds#2560mvanhorn wants to merge 1 commit into
Conversation
|
This only works if gtsam is pulled via FetchContent or similar. If it's installed instead, and the macro is used at the top-level, it won't work. |
|
Good catch, and you're right about the boundary. The top-level check ( Two cases I want to separate:
Is (2) the scenario you have in mind? If so, I think the cleaner fix is to stop keying off "am I the top-level project" and only enable |
|
That is the scenario I'm thinking of, although I'm not sure if gating it is the right solution, since I'm not really sure what the use cases are for the |
Summary
Building GTSAM with
-Werrorno longer forces warnings-as-errors onto downstream projects that consume GTSAM via CMake.Why this matters
cmake/GtsamBuildTypes.cmakeset-WerrorintoGTSAM_COMPILE_OPTIONS_PRIVATE_COMMON, aCACHEvariable, so the flag leaked into consuming builds and a single upstream-compiler warning broke downstream compilation (#2401, which @varunagrawal wants fixed). This gates-Werrorso it applies only to GTSAM's own top-level build, not to consumers, and recomputes the flag on each configure so toggling-DGTSAM_BUILD_WITH_WERRORin an existing build directory takes effect (stale cached-Werroris scrubbed).Testing
GTSAM_BUILD_WITH_WERROR=ONadds-Werrorto GTSAM's private options;OFFremoves it; a previously-ONbuild directory reconfigured withOFFno longer carries-Werror.Closes #2401